using System;
using System.Collections;

namespace TimeSheetBLL
{
    /// <summary>
    /// Summary description for DailyHours.
    /// </summary>
    public class DailyHours
    {
        private ArrayList chargeableHours;
        private ArrayList nonChargeableHours;
        private DateTime date;

        public DailyHours(DateTime date)
        {
            this.date = date;
            chargeableHours = new ArrayList();
            nonChargeableHours = new ArrayList();
        }

        public ArrayList ChargeableHours
        {
            get { return chargeableHours; }
            set { chargeableHours = value; }
        }

        public ArrayList NonChargeableHours
        {
            get { return nonChargeableHours; }
            set { nonChargeableHours = value; }
        }

        public DateTime Date
        {
            get { return date; }
            set { date = value; }
        }

        public double GetTotalChargeableHours()
        {
            double total = 0;
            foreach (ChargeableHours ch in chargeableHours)
            {
                total += ch.ChargeHours;
            }
            return total;
        }

        public double GetTotalNonChargeableHours()
        {
            double total = 0;
            foreach (NonChargeableHours nch in nonChargeableHours)
            {
                total += nch.NonChargeHours;
            }
            return total;
        }

        public double GetVariance()
        {
            double chargeable = GetTotalChargeableHours();
            double nonChargeable = GetTotalNonChargeableHours();
            double variance = Constants.VarianceMark;

            if (date.DayOfWeek == DayOfWeek.Saturday ||
                date.DayOfWeek == DayOfWeek.Sunday)
            {
                return chargeable + nonChargeable;
            }
            return chargeable + nonChargeable - variance;
        }
    } //class
} //namespace